//
//  AgriculturalMaterialsMallCollectionViewCell.m
//  AnXin100
//
//  Created by 王合润 on 10/19/18.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "AgriculturalMaterialsMallCollectionViewCell.h"

@interface AgriculturalMaterialsMallCollectionViewCell ()

@property (nonatomic, strong) UIImageView *goodsImageView;

@property (nonatomic, strong) UILabel *titleLabel;

@property (nonatomic, strong) UILabel *priceLabel;

@end

@implementation AgriculturalMaterialsMallCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self creatCell];
    }
    return self;
}

- (void)creatCell {
    
    _goodsImageView = [[UIImageView alloc] init];
    _goodsImageView.image = [UIImage imageNamed:@"nyqptzs.png"];
    _goodsImageView.clipsToBounds=YES;
    _goodsImageView.contentMode =UIViewContentModeScaleAspectFill;
    [self.contentView addSubview:_goodsImageView];
    
    _titleLabel = [UILabel new];
    _titleLabel.font = [UIFont systemFontOfSize:14];
    _titleLabel.textColor = [UIColor colorWithHex:0x333333];
    _titleLabel.numberOfLines = 0;
    [self.contentView addSubview:_titleLabel];
    
    _priceLabel = [UILabel new];
    _priceLabel.font = [UIFont systemFontOfSize:12];
    _priceLabel.textColor = COLOR_ORG;
    _priceLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_priceLabel];
    
}

- (void)layoutSubviews {
    self.goodsImageView.sd_layout
    .leftSpaceToView(self.contentView, 0)
    .topSpaceToView(self.contentView, 0)
    .widthIs(self.mj_w)
    .heightIs(115);
    [self layoutIfNeeded];
    
    self.titleLabel.sd_layout
    .leftEqualToView(self.goodsImageView)
    .topSpaceToView(self.goodsImageView, 7)
    .widthIs(self.goodsImageView.mj_w)
    .heightIs(15);
    [self layoutIfNeeded];
    
    self.priceLabel.sd_layout
    .leftEqualToView(self.goodsImageView)
    .widthIs(self.goodsImageView.mj_w)
    .topSpaceToView(self.goodsImageView, 30)
    .heightIs(15);
    
    


}


- (void)setDic:(NSDictionary *)dic {
    _titleLabel.text = dic[@"title"];
    _priceLabel.text = dic[@"price"];
}




@end
